using Boo.Lang;
using MaterialUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class StadiumSelect3D : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024change1_0024413 : GenericGenerator<WaitForSeconds>
	{
		internal StadiumSelect3D _0024self__0024415;

		public _0024change1_0024413(StadiumSelect3D self_)
		{
			_0024self__0024415 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024415);
		}
	}

	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024change2_0024416 : GenericGenerator<WaitForSeconds>
	{
		internal StadiumSelect3D _0024self__0024418;

		public _0024change2_0024416(StadiumSelect3D self_)
		{
			_0024self__0024418 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024418);
		}
	}

	public AudioClip clip;

	public Color pressed;

	public Color unpressed;

	public GameObject currentarena;

	public string arenatoload;

	public GameObject st1;

	public GameObject st2;

	public GameObject st3;

	public GameObject st4;

	public GameObject st5;

	public GameObject st6;

	public GameObject st7;

	public GameObject st8;

	public Collider arena1;

	public Collider arena2;

	public Collider arena3;

	public Collider arena4;

	public Collider arena5;

	public Collider arena6;

	public Collider arena7;

	public Collider arena8;

	public Collider back;

	public Collider play;

	public Collider arcade;

	public Collider multiplayer;

	public Collider leaderBoards;

	public Camera mainCamera;

	public int arc;

	public GameObject highscore;

	public int canLog;

	public GameObject purchaseIap;

	public GameObject leaderboardsOpener;

	public StadiumSelect3D()
	{
		arenatoload = string.Empty;
	}

	public void Start()
	{
		if (Social.localUser.authenticated)
		{
			canLog = 1;
		}
		Time.timeScale = 1f;
		Time.fixedDeltaTime = 0.033f;
		if (PlayerPrefs.GetInt("Arcade") == 0)
		{
			arcade.GetComponent<Renderer>().material.color = unpressed;
			arcade.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arc = 0;
		}
		if (PlayerPrefs.GetInt("Arcade") == 1)
		{
			arcade.GetComponent<Renderer>().material.color = pressed;
			arcade.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arc = 1;
		}
	}

	public void Update()
	{
		if (Input.GetMouseButtonUp(0))
		{
			st();
		}
		if (!Input.GetMouseButtonDown(0))
		{
			return;
		}
		RaycastHit hitInfo = default(RaycastHit);
		if (!Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f))
		{
			return;
		}
		if (hitInfo.collider.name == "Select Stadium" && Input.deviceOrientation == DeviceOrientation.FaceDown)
		{
			UnityEngine.SceneManagement.SceneManager.LoadScene("loader");
		}
		if (hitInfo.collider.name == "Arena1")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena1load";
			st1.SetActiveRecursively(state: true);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = pressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena2")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena2load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: true);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = pressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena3")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena3load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: true);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = pressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena4")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena4load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: true);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = pressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena5")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena5load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: true);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = pressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena6")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "sea stadiumload";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: true);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = pressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena7")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena7load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: true);
			st8.SetActiveRecursively(state: false);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = pressed;
			arena8.GetComponent<Renderer>().material.color = unpressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		}
		if (hitInfo.collider.name == "Arena8")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			arenatoload = "arena8load";
			st1.SetActiveRecursively(state: false);
			st2.SetActiveRecursively(state: false);
			st3.SetActiveRecursively(state: false);
			st4.SetActiveRecursively(state: false);
			st5.SetActiveRecursively(state: false);
			st6.SetActiveRecursively(state: false);
			st7.SetActiveRecursively(state: false);
			st8.SetActiveRecursively(state: true);
			arena1.GetComponent<Renderer>().material.color = unpressed;
			arena2.GetComponent<Renderer>().material.color = unpressed;
			arena3.GetComponent<Renderer>().material.color = unpressed;
			arena4.GetComponent<Renderer>().material.color = unpressed;
			arena5.GetComponent<Renderer>().material.color = unpressed;
			arena6.GetComponent<Renderer>().material.color = unpressed;
			arena7.GetComponent<Renderer>().material.color = unpressed;
			arena8.GetComponent<Renderer>().material.color = pressed;
			arena1.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena2.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena3.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena4.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena5.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena6.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena7.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
			arena8.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
		}
		if (hitInfo.collider.name == "Back")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene("mainmenu2");
			back.GetComponent<Renderer>().material.color = pressed;
			back.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
		}
		if (hitInfo.collider.name == "Play")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			if (string.IsNullOrEmpty(arenatoload))
			{
				ToastManager.Show("Select a Stadium first", 1f);
				return;
			}
			if (arenatoload == "arena8load" || arenatoload == "arcadecircle8load")
			{
				if (canLog == 1 && Social.localUser.userName == "miksumortti")
				{
					UnityEngine.SceneManagement.SceneManager.LoadScene(arenatoload);
					return;
				}
				if (PlayerPrefs.GetInt("tmp") != 7)
				{
					UnityEngine.Object.Instantiate(purchaseIap);
					return;
				}
				UnityEngine.SceneManagement.SceneManager.LoadScene(arenatoload);
			}
			UnityEngine.SceneManagement.SceneManager.LoadScene(arenatoload);
		}
		if (hitInfo.collider.name == "Arcade")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			if (arc == 1)
			{
				StartCoroutine(change1());
			}
			if (arc == 0)
			{
				StartCoroutine(change2());
			}
		}
		if (hitInfo.collider.name == "Multiplayer")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene("loader");
			multiplayer.GetComponent<Renderer>().material.color = pressed;
			multiplayer.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
		}
		if (hitInfo.collider.name == "LeaderBoards")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			if (Social.localUser.authenticated)
			{
				Social.ShowLeaderboardUI();
			}
			else
			{
				UnityEngine.Object.Instantiate(leaderboardsOpener);
			}
			leaderBoards.GetComponent<Renderer>().material.color = pressed;
			leaderBoards.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
		}
	}

	public void st()
	{
		back.GetComponent<Renderer>().material.color = unpressed;
		play.GetComponent<Renderer>().material.color = unpressed;
		leaderBoards.GetComponent<Renderer>().material.color = unpressed;
		back.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		play.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		leaderBoards.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
	}

	public IEnumerator change1()
	{
		return new _0024change1_0024413(this).GetEnumerator();
	}

	public IEnumerator change2()
	{
		return new _0024change2_0024416(this).GetEnumerator();
	}

	public void Main()
	{
	}
}
